COMP SCI 180 PROJ 3

PART 1: Defining Correspondences

I used the tool in the spec to define corresponding points on an image of myself and my mom. I used around 100 points. I made sure to do a consistent labeling. Then, I found the triangulation of these points using Delaunay triangulation on the mean of the two sets of points.

Me with keypoints/triangulation:

Mom with keypoints/triangulation:

PART 2: Computing the Mid-way Face

Next, to compute the mid-way face, I computed the average of each keypoint location in the two faces.

avg_shape =  1⁄2 (im1_pts + im2_pts)

Then, I warped both faces into the average shape by doing an inverse warp. First, I looped over all triangles of the Delaunay triangulation of the mean shape. For each loop, I got the indices of the current mean triangle so that I could get the triangle vertices of my two images and the mean image. Then, I had to compute the affine transformation matrix A for both the picture of me and my mom. I then used the skimage.draw polygon function to find my original coordinates and my new coordinates. I then applied the inverse of A to my new coordinates, which gave me which values my new coordinates should map to on my original images. I then used griddata for interpolation, and then set the values of my new triangle to the new values I found. Lastly, I blended both warped images together with a 50 percent dissolve fraction for each warped image, so that I could get the midway image.

Me: Mom:

Midway:

PART 3: The Morph Sequence

To produce my morph sequence, I made the morph function using the same logic as part 2, but I added the warp and dissolve fractions. The warp function controls the warping and the dissolve function controls the color. I produced 45 frames of animation.For my starting frame, they both equal 0, and for my ending frame, they both equal 1. I incremented both values an equal amount each frame.

warp_frac = i / (num_frames - 1)
dissolve_frac = i / (num_frames - 1)

video link to morph sequence: https://youtu.be/JepSJhNKidg

PART 4: The Mean Face of a Population

For the mean face section, I used the FEI face database in the spec (https://fei.edu.br/~cet/facedatabase.html). I used only the neutral faces, which I extracted by taking only the images and keypoints that had filenames ending in “a”. I used 98 of these images. (I used this number of images because I wrote a function which went through the keypoints folder and the images folder and got all of the files ending with “a” and matched up the number of the keypoint file to the image file. For example, I matched up 1a.pts with 1a.jpg. There were 98 images left after I matched all of them up.) I then averaged all the keypoints, found the Delauney of the average shape, then morphed each face to the average shape. Then, I computed the average face of the population.

Examples of faces morphed to the average shape:

Average brazilian face:

Lastly, I used my morph function to warp my face into the average shape, and the average face into my geometry.

Me warped to average:

Average warped to my shape:

PART 5: Caricatures: Extrapolating From the Mean

I made caricatures of my face by extrapolating from the population mean calculated in the last step. I did this my experimenting with my warp_frac.

Bells and Whistles: Gender Change

To do a gender change, I found the average Chinese male face, and did the same procedure as I did in step 1, resizing/cropping and finding corresponding points between the two images. I then experimented with only changing the shape, only the appearance, then both.

(chinese man, https://pmsol3.wordpress.com/2009/10/10/world-of-facial-averages-east-southeast-asia-pacific-islander/)

(changing the shape)

(changing the shape)

(changing both)